package ${dispatchImpl};

import java.util.List;
import com.open.model.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ${service}.I${className}Service;
import ${dispatch}.I${className}Dispatch;
import ${entity}.${className};

/**
 * $!codeName
 *
 * @author $!currentUser
 * @date $!date
 */
@Component(value="$!{lowerName}Dispatch")
@Slf4j
public class ${className}DispatchImpl implements I${className}Dispatch{

	private I${className}Service ${lowerName}Service;

    @Autowired
	public void set${className}Service(I${className}Service ${lowerName}Service) {
		this.${lowerName}Service = ${lowerName}Service;
	}

	@Override
	public Boolean save(${className} model) {
		return ${lowerName}Service.save(model);
	}

	@Override
	public Boolean update(${className} model) {
		return ${lowerName}Service.update(model);
	}

	@Override
	public Boolean batchSave(List<${className}> models) {
		return ${lowerName}Service.batchSave(models);
	}

	@Override
	public Boolean batchUpdate(List<${className}> models) {
		return ${lowerName}Service.batchUpdate(models);
	}

	@Override
	public Page<${className}> findPage(Page<${className}> page, ${className} item) {
		return ${lowerName}Service.findPage(page, item);
	}
	
	@Override
	public ${className} findByPk(${pk.jdbcType} pk) {
		return ${lowerName}Service.findByPk(pk);
	}

	@Override
    public Integer countByModel(${className} model) {
		return ${lowerName}Service.countByModel(model);
	}

	@Override
    public List<${className}> findByModel(${className} model) {
		return ${lowerName}Service.findByModel(model);
	}

	@Override
	public Boolean remove(List<${pk.jdbcType}> pks) {
		return ${lowerName}Service.remove(pks);
	}

	@Override
	public Boolean delete(${pk.jdbcType} pk) {
		return ${lowerName}Service.delete(pk);
	}
}